﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace RegisterClientForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void but_Register_Click(object sender, EventArgs e)
        {
            int id = int.Parse(txt_Id.Text.ToString());
            string name = txtName.Text.ToString();
            string email = txtEmail.Text.ToString();
            ClassUser us = new ClassUser();
            us.setId(id);
            us.setName(name);
            us.setEmail(email);
            us.setFlag(0);

            DataProvider data = new DataProvider();
            string s = data.insertData(us);
            MessageBox.Show(s);

            DataProvider data1 = new DataProvider();
            DataTable dt = data1.SetlectAllData();
            dataGridView1.DataSource = dt;

            SyncApp client_Server = new SyncApp();
            client_Server.fromClientToServer();

            txt_Id.Clear();
            txtName.Clear();
            txtEmail.Clear();
            
        }

        private void butt_Show_Click(object sender, EventArgs e)
        {

            SyncApp server_client = new SyncApp();
            server_client.fromServerToClient();

            DataProvider data = new DataProvider();
            DataTable dt = data.SetlectAllData();
            dataGridView1.DataSource = dt;

        }
    }
}
